<?php
/**
 * 默认接口服务类
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */

class Api_Comment extends PhalApi_Api {

	public function getRules() {
        return array(
            'setRecord' => array(
				'event_id'=>array('name'=>'EventId','require'=>true),
				'doctor_id'=>array('name'=>'DoctorId','require'=>true),
                'record' 	=> array('name' => 'record' ),
            ),
			'listRecord' => array(
				'event_id'=>array('name'=>'EventId','require'=>true),
				),


        );
	}
	
	/**
	     * 添加事后记录
	     * @desc 添加事后记录
	     * @return int code 操作码，0表示成功， 1错误
	     * @return object info 信息对象
	     * @return string msg 提示信息
	     */
	public function setRecord() {
	        $rs = array('code' => 0, 'msg' => '', 'info' =>array('a'=>1));

	        $domain = new Domain_Comment();
	        $info = $domain->setComment("",$this->event_id,$this->doctor_id,"",$this->record);

	        if (empty($info)) {
	            DI()->logger->debug('setRecord()','');

	            $rs['code'] = 1;
	            $rs['msg'] = T('添加事后记录失败');
	            return $rs;
	        }

	        $rs['info'] = $info;
	        DI()->logger->debug('info of setRecord()', $rs);

	        return $rs;

	    }
	/**
	     * 记录列表
	     * @desc 列出记录内容
	     * @return int code 操作码，0表示成功， 1错误
	     * @return object info 信息对象
	     * @return string msg 提示信息
	     */
	public function listRecord() {
	        $rs = array('code' => 0, 'msg' => '', 'info' =>array('a'=>1));

	        $domain = new Domain_Comment();
	        $info = $domain->listRecord($this->event_id);

	        if (empty($info)) {
	            DI()->logger->debug('listRecord','');

	            $rs['code'] = 1;
	            $rs['msg'] = T('暂时没有记录记录');
	            return $rs;
	        }

	        $rs['info'] = $info;
	        DI()->logger->debug('info of listRecord', $rs);

	        return $rs;

	    }
}